import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:largefriends/res/lf_color.dart';
import 'package:largefriends/res/lf_fonts.dart';
import 'package:largefriends/res/lf_text_style.dart';

class LfRoundedTag extends StatefulWidget {
  const LfRoundedTag({
    super.key,
    this.height,
    this.alignment,
    required this.content,
    this.onTap,
  });
  final dynamic content;
  final double? height;
  final Alignment? alignment;
  final Function()? onTap;
  @override
  State<LfRoundedTag> createState() => _LfRoundedTagState();
}

class _LfRoundedTagState extends State<LfRoundedTag> {
  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: () {
        widget.onTap?.call();
      },
      child: Container(
        height: widget.height ?? 44.h,
        alignment: widget.alignment ?? Alignment.center,
        decoration: BoxDecoration(
          border: Border.all(color: color210215, width: 2),
          borderRadius: BorderRadius.circular(
              widget.height == null ? 22.h : (widget.height! / 2)),
        ),
        padding: EdgeInsets.symmetric(
            horizontal: widget.height == null ? 22.h : (widget.height! / 2)),
        child: Builder(builder: (context) {
          if (widget.content is String) {
            return Text(
              widget.content,
              style: lfTextStyle(sp: 16.sp, fontFamily: fontBold),
              overflow: TextOverflow.ellipsis,
            );
          } else if (widget.content is Widget) {
            return widget.content;
          } else {
            return const SizedBox.shrink();
          }
        }),
      ),
    );
  }
}
